package com.jiangyao.controller;

import com.jiangyao.common.ApiResult;
import com.jiangyao.model.dto.ClassInfoDto;
import com.jiangyao.model.vo.ClassmateVo;
import com.jiangyao.service.ClassUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhousx
 * @create 2020/9/17
 */
@RestController
@RequestMapping("/collect")
@Api(tags = "班级相关接口")
public class ClassController {
    @Autowired
    private ClassUserService classUserService;

    @PostMapping("/getClassmateCount")
    @ApiOperation(value = "获取同学数量")
    public ApiResult getClassmateCount(@RequestBody ClassInfoDto classInfoDto){
        Integer classmateCount = classUserService.getClassmateCount(classInfoDto);
        return ApiResult.success(classmateCount);
    }

    @PostMapping("/getClassmate")
    @ApiOperation(value = "获取同学学习详情")
    public ApiResult<List<ClassmateVo>> getgetClassmate(@RequestBody ClassInfoDto classInfoDto){
        List<ClassmateVo> classmate = classUserService.getClassmate(classInfoDto);
        return ApiResult.success(classmate);
    }
}
